package com.tydic.order.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tydic.order.domain.OrderContract;
import com.tydic.order.mapper.OrderContractMapper;
import com.tydic.order.service.IOrderContractService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@RequiredArgsConstructor
@Service
@Slf4j
public class OrderContractServiceImpl implements IOrderContractService {
    private final OrderContractMapper orderContractMapper;

    @Override
    public OrderContract getByOrderCode(String orderCode) {
        return orderContractMapper.selectOne(Wrappers.lambdaQuery(OrderContract.class).eq(OrderContract::getOrderCode, orderCode), false);
    }

    @Override
    public List<OrderContract> getByDocId(String docId) {
        return orderContractMapper.selectList(Wrappers.lambdaQuery(OrderContract.class).eq(OrderContract::getDocId, docId));
    }
}
